﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Web;
using System.Windows.Forms;
using WebHacker;
using log4net;

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]	
namespace HttpTest
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            //log4net.ILog[] ls = log4net.LogManager.GetCurrentLoggers();

            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form_MCD_Auto());
            //Program.Test();
            Program.MerckTriger();
        }

        private static void MerckTriger()
        {
            //string strHost = ConfigurationManager.AppSettings["Host"];
            //WebTools wt = new WebTools();
            //HttpRequestDictionary hrd = new HttpRequestDictionary();
            //hrd.Add("UserName", "900000");
            //hrd.Add("Password", "000000");
            //hrd.Add("RememberMe", "false");
            //wt.SubmitFormData(strHost, hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPPTP/PTPReceived", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPEEM/EEMReceived", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPAHPTP/AHPTPReceived", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPAHEEM/AHEEMReceived", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPMDM/MDMReceived", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPMDMHCP/MDMHCPReceived", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPOTC/Received", hrd.ToString());
            //hrd = new HttpRequestDictionary();
            //hrd.Add("ReceiveDate", "");
            //wt.SubmitFormData(strHost + "GPRTR/RTRReceived", hrd.ToString());



            //http://54.56.18.228:8080/ja-jp/

            var wt =
       new WebTools();


            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-jp/Account/LogOn", @"UserName=900000&Password=000000&RememberMe=false");
            
            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPOTC/Received", @"ReceiveDate=");

            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPPTP/PTPReceived", @"ReceiveDate=");
            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPEEM/EEMReceived", @"ReceiveDate=");
            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPAHPTP/AHPTPReceived", @"ReceiveDate=");
            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPAHEEM/AHEEMReceived", @"ReceiveDate=");
            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPMDM/MDMReceived", @"ReceiveDate=");
            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPMDMHCP/MDMHCPReceived", @"ReceiveDate=");

            wt.SubmitFormData(@"http://54.56.18.228:8080/ja-JP/GPRTR/RTRReceived", @"ReceiveDate=");
            
        }

        private static void Test()
        {

            var wt =
                   new WebTools();


            wt.SubmitFormData(@"http://58.2.221.87/MCDL/Account/LogOn", @"LoginName=sysadmin&Password=112233&RememberMe=false");
            //wt.SubmitFormData(@"http://58.2.219.90:1303/Account/LogOn", @"LoginName=sysadmin&Password=000000&RememberMe=false");
            var strDate =
                HttpUtility.UrlEncode((DateTime.Now.ToString("yyyy/MM/dd")));

            //wt.SubmitFormData(@"http://58.2.219.90:1303/ja-JP/NonPOGP/Received", @"ReceiveDate=" + strDate);

            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/NonPOGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/POGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/ARGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/DCSupportGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/FAHRAPARGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/FAOthersGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/JVPaymentGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/LOFCGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/MarketingGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/OverseasPaymentGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/PaymentClearingGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/StoreAcctGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/TaxGLAPARVoucherGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/TEGP/Received", @"ReceiveDate=" + strDate);
            wt.SubmitFormData(@"http://58.2.221.87/MCDL/ja-JP/TreasuryAPARVoucherGP/Received", @"ReceiveDate=" + strDate);
        }

    }
}
